# 创建500个用户名不同的用户
# 格式为username;password;code
# 保存到user.txt文件中

import random
import string

def generate_users(num_users=500):
    users = []
    for i in range(1, num_users + 1):
        username = f"user{i}"
        # password = ''.join(random.choices(string.ascii_letters + string.digits, k=8))  # 随机生成8位密码
        password = '123456'
        # code = ''.join(random.choices(string.ascii_uppercase + string.digits, k=6))    # 随机生成6位code
        code = 100
        users.append(f"{username};{password};{code}")
    return users

def save_users_to_file(users, filename="user.txt"):
    with open(filename, "w") as file:
        for user in users:
            file.write(user + "\n")

if __name__ == "__main__":
    users = generate_users()
    save_users_to_file(users)
